﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frame.Lib.Core.Company;
using Frame.Lib.Core.Log;

namespace Frame.Lib.Core.Cache.Company
{
    public class CompanyLoader : CacheLoaderBase
    {

        public override void LoadData()
        {
            try
            {
                CompanyContainer container = new CompanyContainer();

                CompanyBO company = new CompanyBO();
                List<CompanyInfo> coms = company.GetList();
                container.ConnectionStrings = new Dictionary<int, string>();
                foreach (CompanyInfo info in coms)
                {
                    container.ConnectionStrings.Add(info.ID, info.ConnectionString);
                }

                LoadComplete(container);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "load company cache fail");
            }
        }
    }
}
